package ${packageName}.controller;

import ${packageName}.service.I${className}Service;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import ${packageName}.dto.${lowerClassName}.query.${className}QueryDto;
import ${packageName}.dto.${lowerClassName}.input.${className}InputDto;
import ${packageName}.vo.${lowerClassName}.${className}Vo;
import org.springframework.web.bind.annotation.PostMapping;
import javax.annotation.Resource;
import com.github.pagehelper.PageInfo;
import ${basePackageName}.vo.CommonResultVo;
import ${basePackageName}.log.annotation.Log;


@Api(tags = "${remark}接口")
@RestController

public class ${className}Controller {

    @Resource
    private I${className}Service ${lowerClassName}Service;

    /**
     * 新增修改${remark}
     * @return
     */
    @PostMapping("/${lowerClassName}/saveOrUpdate")
    @ApiOperation(value = "新增${remark}")
    @Log("新增${remark}")
    public CommonResultVo<${className}Vo> save(@ModelAttribute ${saveClassName} ${lowerSaveClassName}){
        ${className}Vo ${lowerClassName}Vo=  ${lowerClassName}Service.saveOrUpdate(${lowerSaveClassName});
        return CommonResultVo.success(${lowerClassName}Vo);
    }



    /**
     * 删除${remark}
     * @return
     */
    @PostMapping("/${lowerClassName}/delete")
    @ApiOperation(value = "删除${remark}")
    @Log("删除${remark}")
    public CommonResultVo delete(${primaryClassType} ${primaryClassName}){
        ${lowerClassName}Service.deleteByPrimary(${primaryClassName});
        return  CommonResultVo.success("操作成功");
    }


    /**
     * 获取${remark}
     * @return
     */
    @PostMapping("/${lowerClassName}/get")
    @ApiOperation(value = "获取${remark}")
    @Log("获取${remark}")
    public CommonResultVo<${className}Vo> get(${primaryClassType} ${primaryClassName}){
        ${className}Vo ${lowerClassName}Vo=${lowerClassName}Service.getVoByPrimary(${primaryClassName});
        return  CommonResultVo.success(${lowerClassName}Vo);
    }

    /**
     * 获取${remark}分页
     * @param ${lowerClassSearchName} 查询参数对象
     * @return
     */
    @PostMapping("/${lowerClassName}/getPage")
    @ApiOperation(value = "获取${remark}分页列表")
    @Log("获取${remark}分页列表")
    public  CommonResultVo<PageInfo<${className}Vo>>  queryPage(@ModelAttribute ${classSearchName} ${lowerClassSearchName}){
         PageInfo<${className}Vo> pageInfo= ${lowerClassName}Service.getPage(${lowerClassSearchName});
         return CommonResultVo.success(pageInfo);
    }


}
